; ORIGINAL: 3dt2.1/examples/attribut.scm
; $Id: attribut.scm,v 1.3 1996/10/21 15:58:53 aed Exp $
;- attribut.scm ---------------------------------------------------
; Assign two name/value attribute pairs to an entity, then modify them.
; Demonstrate non-volatility by saving, restoring and displaying the entity.
;------------------------------------------------------------------

;; Create a block and add some attributes
(define blk (solid:block (position 0 0 0) (position 20 30 40)))
(attrib:add blk "name" "cornerstone")
(attrib:add blk "volume" 24000)

;; Display the attributes
(display (attrib:get blk))
(newline)

;; Add and modify attributes
(attrib:replace blk "volume" 12000)
(attrib:add blk "name" "granite")
(display (attrib:get blk))
(newline)

;; Remove all name attributes
(attrib:remove blk "name")
(display (attrib:get blk))
(newline)

;; Save and restore part
(part:save "attrib.sat")
(part:clear)
(part:load "attrib.sat")

;; Display attributes for first restored entity
(display (attrib:get (car (part:entities))))
(newline)
